package com.lunhui.monster.business.impl;

import com.alibaba.dubbo.common.logger.LoggerFactory;
import com.lunhui.monster.business.MonsterService;
import com.lunhui.monster.dal.dao.MonsterDao;
import com.lunhui.monster.dal.model.Monster;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import com.alibaba.dubbo.common.logger.Logger;

/**
 * @author renminghe-kg
 */

@Service("monsterService")
public class MonsterServiceImpl implements MonsterService {
    private static final Logger logger = LoggerFactory.getLogger(MonsterServiceImpl.class);

    @Resource
    @Qualifier("monsterDao")
    private MonsterDao monsterDao;

    @Override
    public List<Monster> getMonsterListInfo(int areaId, int sceneId) throws Exception {
        List<Monster> monsterList;

        Monster monster = new Monster();
        monster.setAreaId(areaId);
        monster.setSceneId(sceneId);

        try {
            monsterList = monsterDao.getMonsterListInfo(monster);
        } catch (Exception e) {
            logger.error("查询怪物列表数据表失败: " + e.getMessage());

            throw new RuntimeException(e);
        }

        return monsterList;
    }
}